package controllayer;

import java.util.ArrayList;
import modellayer.*;

/**
 * The Class PersonController.
 *@author Benjamin Ørskov
 *@author Lasse Lambertsen
 *@author Ole Kirk
 *@author Søren Søgaard
 */
public class PersonController {

	/** The p con. */
	private PersonContainer pCon;

	/**
	 * Instantiates a new person controller.
	 */
	public PersonController() {
		pCon = PersonContainer.getInstance();
	}

	/**
	 * Gets the salesman id.
	 *
	 * @return the salesman id
	 */
	public int getSalesmanID() {
		return pCon.getSalesmanID();
	}

	/**
	 * Gets the salesman array.
	 *
	 * @return the salesman array
	 */
	public ArrayList<Salesman> getSalesmanArray() {
		return pCon.getSalesmanArray();
	}

	/**
	 * Gets the person array.
	 *
	 * @return the person array
	 */
	public ArrayList<Person> getPersonArray() {
		return pCon.getPersons();
	}

	/**
	 * Find salesman.
	 *
	 * @param id
	 *            the id
	 * @return the person
	 */
	public Person findSalesman(int id) {
		return pCon.findSalesman(id);
	}

	/**
	 * Find customer.
	 *
	 * @param phone
	 *            the phone
	 * @return the person
	 */
	public Person findCustomer(String phone) {
		return pCon.findCustomer(phone);
	}

	/**
	 * Find business customer.
	 *
	 * @param cvr
	 *            the cvr
	 * @return the person
	 */
	public Person findBusinessCustomer(String cvr) {
		return pCon.findBusinessCustomer(cvr);
	}

	/**
	 * Removes the person.
	 *
	 * @param tempP
	 *            the temp p
	 */
	public void removePerson(Person tempP) {
		pCon.removePerson(tempP);
	}

	/**
	 * Update salesman.
	 *
	 * @param tempP
	 *            the temp p
	 * @param name
	 *            the name
	 * @param address
	 *            the address
	 * @param city
	 *            the city
	 * @param email
	 *            the email
	 * @param phone
	 *            the phone
	 * @param paycheck
	 *            the paycheck
	 * @param bonus
	 *            the bonus
	 */
	public void updateSalesman(Person tempP, String name, String address,
			String city, String email, String phone, Double paycheck,
			Double bonus) {
		pCon.updateSalesman(tempP, name, address, city, email, phone, paycheck,
				bonus);
	}

	/**
	 * Update business customer.
	 *
	 * @param tempP
	 *            the temp p
	 * @param name
	 *            the name
	 * @param address
	 *            the address
	 * @param city
	 *            the city
	 * @param email
	 *            the email
	 * @param phone
	 *            the phone
	 * @param cvr
	 *            the cvr
	 * @param discount
	 *            the discount
	 */
	public void updateBusinessCustomer(Person tempP, String name,
			String address, String city, String email, String phone,
			String cvr, Double discount) {
		pCon.updateBusinessCustomer(tempP, name, address, city, email, phone,
				cvr, discount);
	}

	/**
	 * Update customer.
	 *
	 * @param tempP
	 *            the temp p
	 * @param name
	 *            the name
	 * @param address
	 *            the address
	 * @param city
	 *            the city
	 * @param email
	 *            the email
	 * @param phone
	 *            the phone
	 */
	public void updateCustomer(Person tempP, String name, String address,
			String city, String email, String phone) {
		pCon.updateCustomer(tempP, name, address, city, email, phone);
	}

	/**
	 * Creates the salesman.
	 *
	 * @param name
	 *            the name
	 * @param address
	 *            the address
	 * @param city
	 *            the city
	 * @param email
	 *            the email
	 * @param phone
	 *            the phone
	 * @param paycheck
	 *            the paycheck
	 * @return the string
	 */
	public String createSalesman(String name, String address, String city,
			String email, String phone, Double paycheck) {
		return pCon.createSalesman(name, address, city, email, phone, paycheck);
	}

	/**
	 * Creates the business customer.
	 *
	 * @param name
	 *            the name
	 * @param address
	 *            the address
	 * @param city
	 *            the city
	 * @param email
	 *            the email
	 * @param phone
	 *            the phone
	 * @param cvr
	 *            the cvr
	 * @param discount
	 *            the discount
	 */
	public void createBusinessCustomer(String name, String address,
			String city, String email, String phone, String cvr, Double discount) {

		pCon.createBusinessCustomer(name, address, city, email, phone, cvr,
				discount);
	}

	/**
	 * Creates the customer.
	 *
	 * @param name
	 *            the name
	 * @param address
	 *            the address
	 * @param city
	 *            the city
	 * @param email
	 *            the email
	 * @param phone
	 *            the phone
	 */
	public void createCustomer(String name, String address, String city,
			String email, String phone) {
		pCon.createCustomer(name, address, city, email, phone);
	}
}